// Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Runtime.CompilerServices;

namespace Windows7.DesktopIntegration.Interop
{
	//Based on Rob Jarett's wrappers for the desktop integration PDC demos.

	[ComImportAttribute()]
	[GuidAttribute( "000214F9-0000-0000-C000-000000000046" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IShellLinkW
	{
		void GetPath(
				[Out(), MarshalAs( UnmanagedType.LPWStr )] StringBuilder pszFile,
				int cchMaxPath,
			//ref _WIN32_FIND_DATAW pfd,
				IntPtr pfd,
				uint fFlags );
		void GetIDList( out IntPtr ppidl );
		void SetIDList( IntPtr pidl );
		void GetDescription(
				[Out(), MarshalAs( UnmanagedType.LPWStr )] StringBuilder pszFile,
				int cchMaxName );
		void SetDescription(
				[MarshalAs( UnmanagedType.LPWStr )] string pszName );
		void GetWorkingDirectory(
				[Out(), MarshalAs( UnmanagedType.LPWStr )] StringBuilder pszDir,
				int cchMaxPath
				);
		void SetWorkingDirectory(
				[MarshalAs( UnmanagedType.LPWStr )] string pszDir );
		void GetArguments(
				[Out(), MarshalAs( UnmanagedType.LPWStr )] StringBuilder pszArgs,
				int cchMaxPath );
		void SetArguments(
				[MarshalAs( UnmanagedType.LPWStr )] string pszArgs );
		void GetHotKey( out short wHotKey );
		void SetHotKey( short wHotKey );
		void GetShowCmd( out uint iShowCmd );
		void SetShowCmd( uint iShowCmd );
		void GetIconLocation(
				[Out(), MarshalAs( UnmanagedType.LPWStr )] StringBuilder pszIconPath,
				int cchIconPath,
				out int iIcon );
		void SetIconLocation(
				[MarshalAs( UnmanagedType.LPWStr )] string pszIconPath,
				int iIcon );
		void SetRelativePath(
				[MarshalAs( UnmanagedType.LPWStr )] string pszPathRel,
				uint dwReserved );
		void Resolve( IntPtr hwnd, uint fFlags );
		void SetPath(
				[MarshalAs( UnmanagedType.LPWStr )] string pszFile );
	}

	[GuidAttribute( "00021401-0000-0000-C000-000000000046" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CShellLink { }

	[ComImportAttribute()]
	[GuidAttribute( "92CA9DCD-5622-4BBA-A805-5E9F541BD8C9" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IObjectArray
	{
		void GetCount( out uint cObjects );
		void GetAt(
				uint iIndex,
				ref Guid riid,
				[Out(), MarshalAs( UnmanagedType.Interface )] out object ppvObject );
	}

	[ComImportAttribute()]
	[GuidAttribute( "5632B1A4-E38A-400A-928A-D4CD63230295" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IObjectCollection
	{
		// IObjectArray
		[PreserveSig]
		void GetCount( out uint cObjects );
		[PreserveSig]
		void GetAt(
				uint iIndex,
				ref Guid riid,
				[Out(), MarshalAs( UnmanagedType.Interface )] out object ppvObject );

		// IObjectCollection
		void AddObject(
				[MarshalAs( UnmanagedType.Interface )] object pvObject );
		void AddFromArray(
				[MarshalAs( UnmanagedType.Interface )] IObjectArray poaSource );
		void RemoveObject( uint uiIndex );
		void Clear();
	}

	[ComImport,
	Guid( IIDGuid.IPropertyStore ),
	InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IPropertyStore
	{
		void GetCount( out UInt32 cProps );
		void GetAt(
				UInt32 iProp,
				[MarshalAs( UnmanagedType.Struct )] out PropertyKey pkey );
		void GetValue(
				[In, MarshalAs( UnmanagedType.Struct )] ref PropertyKey pkey,
				[Out(), MarshalAs( UnmanagedType.Struct )] out PropVariant pv );
		void SetValue(
				[In, MarshalAs( UnmanagedType.Struct )] ref PropertyKey pkey,
				[In, MarshalAs( UnmanagedType.Struct )] ref PropVariant pv );
		void Commit();
	}

	[GuidAttribute( "2D3468C1-36A7-43B6-AC24-D3F02FD9607A" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CEnumerableObjectCollection { }

	[ComImportAttribute()]
	[GuidAttribute( "6332DEBF-87B5-4670-90C0-5E57B408A49E" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface ICustomDestinationList
	{
		void SetAppID(
				[MarshalAs( UnmanagedType.LPWStr )] string pszAppID );
		void BeginList(
				out uint cMaxSlots,
				ref Guid riid,
				[Out(), MarshalAs( UnmanagedType.Interface )] out object ppvObject );
		void AppendCategory(
				[MarshalAs( UnmanagedType.LPWStr )] string pszCategory,
				[MarshalAs( UnmanagedType.Interface )] IObjectArray poa );
		void AppendKnownCategory(
				[MarshalAs( UnmanagedType.I4 )] KNOWNDESTCATEGORY category );
		void AddUserTasks(
				[MarshalAs( UnmanagedType.Interface )] IObjectArray poa );
		void CommitList();
		void GetRemovedDestinations(
				ref Guid riid,
				[Out(), MarshalAs( UnmanagedType.Interface )] out object ppvObject );
		void DeleteList(
				[MarshalAs( UnmanagedType.LPWStr )] string pszAppID );
		void AbortList();
	}

	[GuidAttribute( "77F10CF0-3DB5-4966-B520-B7C54FD35ED6" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CDestinationList { }

	[ComImportAttribute()]
	[GuidAttribute( "12337D35-94C6-48A0-BCE7-6A9C69D4D600" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IApplicationDestinations
	{
		void SetAppID(
				[MarshalAs( UnmanagedType.LPWStr )] string pszAppID );
		void RemoveDestination(
				[MarshalAs( UnmanagedType.Interface )] object pvObject );
		void RemoveAllDestinations();
	}

	[GuidAttribute( "86C14003-4D6B-4EF3-A7B4-0506663B2E68" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CApplicationDestinations { }

	[ComImportAttribute()]
	[GuidAttribute( "3C594F9F-9F30-47A1-979A-C9E83D3D0A06" )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IApplicationDocumentLists
	{
		void SetAppID(
				[MarshalAs( UnmanagedType.LPWStr )] string pszAppID );
		void GetList(
				[MarshalAs( UnmanagedType.I4 )] APPDOCLISTTYPE listtype,
				uint cItemsDesired,
				ref Guid riid,
				[Out(), MarshalAs( UnmanagedType.Interface )] out object ppvObject );
	}

	[GuidAttribute( "86BEC222-30F2-47E0-9F25-60D11CD75C28" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CApplicationDocumentLists { }

	[ComImportAttribute()]
	[GuidAttribute( IIDGuid.ITaskList )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface ITaskbarList
	{
		// ITaskbarList
		[PreserveSig]
		void HrInit();
		[PreserveSig]
		void AddTab( IntPtr hwnd );
		[PreserveSig]
		void DeleteTab( IntPtr hwnd );
		[PreserveSig]
		void ActivateTab( IntPtr hwnd );
		[PreserveSig]
		void SetActiveAlt( IntPtr hwnd );
	}

	[ComImportAttribute()]
	[GuidAttribute( IIDGuid.ITaskList2 )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface ITaskbarList2
	{
		// ITaskbarList
		[PreserveSig]
		void HrInit();
		[PreserveSig]
		void AddTab( IntPtr hwnd );
		[PreserveSig]
		void DeleteTab( IntPtr hwnd );
		[PreserveSig]
		void ActivateTab( IntPtr hwnd );
		[PreserveSig]
		void SetActiveAlt( IntPtr hwnd );

		// ITaskbarList2
		[PreserveSig]
		void MarkFullscreenWindow(
				IntPtr hwnd,
				[MarshalAs( UnmanagedType.Bool )] bool fFullscreen );
	}

	[ComImportAttribute()]
	[GuidAttribute( IIDGuid.ITaskList3 )]
	[InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface ITaskbarList3
	{
		// ITaskbarList
		[PreserveSig]
		void HrInit();
		[PreserveSig]
		void AddTab( IntPtr hwnd );
		[PreserveSig]
		void DeleteTab( IntPtr hwnd );
		[PreserveSig]
		void ActivateTab( IntPtr hwnd );
		[PreserveSig]
		void SetActiveAlt( IntPtr hwnd );

		// ITaskbarList2
		[PreserveSig]
		void MarkFullscreenWindow(
				IntPtr hwnd,
				[MarshalAs( UnmanagedType.Bool )] bool fFullscreen );

		// ITaskbarList3
		void SetProgressValue( IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal );
		void SetProgressState( IntPtr hwnd, TBPFLAG tbpFlags );
		void RegisterTab( IntPtr hwndTab, IntPtr hwndMDI );
		void UnregisterTab( IntPtr hwndTab );
		void SetTabOrder( IntPtr hwndTab, IntPtr hwndInsertBefore );
		void SetTabActive( IntPtr hwndTab, IntPtr hwndMDI, TBATFLAG tbatFlags );
		void ThumbBarAddButtons(
				IntPtr hwnd,
				uint cButtons,
				[MarshalAs( UnmanagedType.LPArray )] THUMBBUTTON[] pButtons );
		void ThumbBarUpdateButtons(
				IntPtr hwnd,
				uint cButtons,
				[MarshalAs( UnmanagedType.LPArray )] THUMBBUTTON[] pButtons );
		void ThumbBarSetImageList( IntPtr hwnd, IntPtr himl );
		void SetOverlayIcon(
			IntPtr hwnd,
			IntPtr hIcon,
			[MarshalAs( UnmanagedType.LPWStr )] string pszDescription );
		void SetThumbnailTooltip(
				IntPtr hwnd,
				[MarshalAs( UnmanagedType.LPWStr )] string pszTip );
		void SetThumbnailClip(
				IntPtr hwnd,
			/*[MarshalAs(UnmanagedType.LPStruct)]*/ ref RECT prcClip );
	}

	[GuidAttribute( "56FDF344-FD6D-11d0-958A-006097C9A090" )]
	[ClassInterfaceAttribute( ClassInterfaceType.None )]
	[ComImportAttribute()]
	internal class CTaskbarList { }


	#region Shell Libraries
	[ComImport,
	 Guid( IIDGuid.IShellLibrary ),
	 InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IShellLibrary
	{
		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void LoadLibraryFromItem(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem library,
				[In] SafeNativeMethods.StorageInstantiationModes grfMode );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void LoadLibraryFromKnownFolder(
				[In] ref Guid knownfidLibrary,
				[In] SafeNativeMethods.StorageInstantiationModes grfMode );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void AddFolder( [In, MarshalAs( UnmanagedType.Interface )] IShellItem location );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void RemoveFolder( [In, MarshalAs( UnmanagedType.Interface )] IShellItem location );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetFolders(
				[In] SafeNativeMethods.LIBRARYFOLDERFILTER lff,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItemArray ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void ResolveFolder(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem folderToResolve,
				[In] uint timeout,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetDefaultSaveFolder(
				[In] SafeNativeMethods.DEFAULTSAVEFOLDERTYPE dsft,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void SetDefaultSaveFolder(
				[In] SafeNativeMethods.DEFAULTSAVEFOLDERTYPE dsft,
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem si );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetOptions(
				out SafeNativeMethods.LIBRARYOPTIONFLAGS lofOptions );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void SetOptions(
				[In] SafeNativeMethods.LIBRARYOPTIONFLAGS lofMask,
				[In] SafeNativeMethods.LIBRARYOPTIONFLAGS lofOptions );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetFolderType( out Guid ftid );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void SetFolderType( [In] ref Guid ftid );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetIcon( [MarshalAs( UnmanagedType.LPWStr )] out string icon );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void SetIcon( [In, MarshalAs( UnmanagedType.LPWStr )] string icon );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void Commit();

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void Save(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem folderToSaveIn,
				[In, MarshalAs( UnmanagedType.LPWStr )] string libraryName,
				[In] SafeNativeMethods.LIBRARYSAVEFLAGS lsf,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem savedTo );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void SaveInKnownFolder(
				[In] ref Guid kfidToSaveIn,
				[In, MarshalAs( UnmanagedType.LPWStr )] string libraryName,
				[In] SafeNativeMethods.LIBRARYSAVEFLAGS lsf,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem savedTo );
	};

	[ComImport, ClassInterface( (short)0 ), Guid( "d9b3211d-e57f-4426-aaef-30a806add397" )]
	internal class ShellLibraryClass : IShellLibrary
	{
		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void LoadLibraryFromItem(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem library,
				[In] SafeNativeMethods.StorageInstantiationModes grfMode );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void LoadLibraryFromKnownFolder(
				[In] ref Guid knownfidLibrary,
				[In] SafeNativeMethods.StorageInstantiationModes grfMode );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void AddFolder( [In, MarshalAs( UnmanagedType.Interface )] IShellItem location );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void RemoveFolder( [In, MarshalAs( UnmanagedType.Interface )] IShellItem location );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetFolders(
				[In] SafeNativeMethods.LIBRARYFOLDERFILTER lff,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItemArray ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void ResolveFolder(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem folderToResolve,
				[In] uint timeout,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetDefaultSaveFolder(
				[In] SafeNativeMethods.DEFAULTSAVEFOLDERTYPE dsft,
				[In] ref Guid riid,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetDefaultSaveFolder(
				[In] SafeNativeMethods.DEFAULTSAVEFOLDERTYPE dsft,
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem si );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetOptions(
				out SafeNativeMethods.LIBRARYOPTIONFLAGS lofOptions );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetOptions(
				[In] SafeNativeMethods.LIBRARYOPTIONFLAGS lofMask,
				[In] SafeNativeMethods.LIBRARYOPTIONFLAGS lofOptions );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetFolderType( out Guid ftid );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetFolderType( [In] ref Guid ftid );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetIcon( [MarshalAs( UnmanagedType.LPWStr )] out string icon );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetIcon( [In, MarshalAs( UnmanagedType.LPWStr )] string icon );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void Commit();

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void Save(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem folderToSaveIn,
				[In, MarshalAs( UnmanagedType.LPWStr )] string libraryName,
				[In] SafeNativeMethods.LIBRARYSAVEFLAGS lsf,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem savedTo );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SaveInKnownFolder(
				[In] ref Guid kfidToSaveIn,
				[In, MarshalAs( UnmanagedType.LPWStr )] string libraryName,
				[In] SafeNativeMethods.LIBRARYSAVEFLAGS lsf,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem savedTo );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetName( [In, MarshalAs( UnmanagedType.LPWStr )] string libraryName );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetName( [MarshalAs( UnmanagedType.LPWStr )] out string libraryName );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void SetAuthor( [In, MarshalAs( UnmanagedType.LPWStr )] string authorName );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void GetAuthor( [MarshalAs( UnmanagedType.LPWStr )] out string authorName );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		public virtual extern void ShowManageLibraryUI(
				[In] IntPtr hwndOwner,
				[In, MarshalAs( UnmanagedType.LPWStr )] string title,
				[In, MarshalAs( UnmanagedType.LPWStr )] string instruction );

	}

	#endregion

	#region VistaBridge

	[ComImport,
	Guid( IIDGuid.IShellItem ),
	InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IShellItem
	{
		// Not supported: IBindCtx.
		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void BindToHandler(
				[In, MarshalAs( UnmanagedType.Interface )] IntPtr pbc,
				[In] ref Guid bhid,
				[In] ref Guid riid,
				out IntPtr ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetParent( [MarshalAs( UnmanagedType.Interface )] out IShellItem ppsi );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetDisplayName(
				[In] SafeNativeMethods.SIGDN sigdnName,
				[MarshalAs( UnmanagedType.LPWStr )] out string ppszName );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetAttributes( [In] uint sfgaoMask, out uint psfgaoAttribs );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void Compare(
				[In, MarshalAs( UnmanagedType.Interface )] IShellItem psi,
				[In] uint hint,
				out int piOrder );
	}

	[ComImport,
	Guid( IIDGuid.IShellItemArray ),
	InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
	internal interface IShellItemArray
	{
		// Not supported: IBindCtx.
		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void BindToHandler(
				[In, MarshalAs( UnmanagedType.Interface )] IntPtr pbc,
				[In] ref Guid rbhid,
				[In] ref Guid riid,
				out IntPtr ppvOut );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetPropertyStore(
				[In] int Flags,
				[In] ref Guid riid,
				out IntPtr ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetPropertyDescriptionList(
				[In] ref SafeNativeMethods.PROPERTYKEY keyType,
				[In] ref Guid riid,
				out IntPtr ppv );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetAttributes(
				[In] SafeNativeMethods.SIATTRIBFLAGS dwAttribFlags,
				[In] uint sfgaoMask,
				out uint psfgaoAttribs );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetCount( out uint pdwNumItems );

		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void GetItemAt(
				[In] uint dwIndex,
				[MarshalAs( UnmanagedType.Interface )] out IShellItem ppsi );

		// Not supported: IEnumShellItems (will use GetCount and GetItemAt instead).
		[MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime )]
		void EnumItems( [MarshalAs( UnmanagedType.Interface )] out IntPtr ppenumShellItems );
	}

	#endregion
}